<!--
 * @Author: daidai
 * @Date: 2022-03-04 09:23:59
 * @LastEditors: Please set LastEditors
 * @LastEditTime: 2022-05-07 11:05:02
 * @FilePath: \web-pc\src\pages\big-screen\view\indexs\index.vue
-->
<template>
  <div class="contents">
    <div class="content_left">
      <div class="pagetab">
        <!-- <div class="item">实时监测</div> -->
      <!-- 左侧 -->
      </div> 
        <ItemWrap class="content_left-center content_lr-item" title="不良率">
          <LeftCenter />
        </ItemWrap>
        <ItemWrap class="content_left-bottom content_lr-item" title="产量">
          <RightTop />
        </ItemWrap>
        <ItemWrap class="content_left-bottom content_lr-item" title="AGV状态"
          style="padding: 0 10px 16px 10px"
        >
          <RightCenter />
        </ItemWrap>
      </div>


    <!-- 中间 -->
    <div class="content_center">
      <div class="content_center_top">
        <ItemWrapNoframe class="content_cb-item" title="3d动画效果">
          <!-- 按钮添加点击事件 -->
          <button class="home_page" @click="changeView('ThreedModel')">数据概览</button>
          <button class="command_page" @click="changeView('ConfIssue')">配置下发</button>

          <!-- 根据 currentView 动态渲染组件 -->
          <component :is="currentView"></component>
        </ItemWrapNoframe>
      </div>

      <div class="content_center_bottom">
        <ItemWrap
          class="content_cbl-item"
          title="AGV报警"
        >
          <CenterBottomLeft />
        </ItemWrap>
        <ItemWrap
          class="content_cbr-item"
          title="机器人报警"
        >
          <CenterBottomRight />
        </ItemWrap>
      </div>
    </div>

    <!-- 右侧 -->
    <div class="contetn_right">
      <ItemWrap class="content_left-center content_lr-item" title="AGV开动率">
        <LeftCenter />
      </ItemWrap>
      <ItemWrap class="content_center-bottom content_lr-item" title="2024 年度任务完成率">
        <CenterBottom />
      </ItemWrap>     
      <ItemWrap class="content_left-bottom content_lr-item" title="任务详情">
        <RightBottom />
      </ItemWrap>
    </div>
  </div>
</template>

<script>
import LeftTop from './left-top.vue'
import LeftCenter from "./left-center.vue";
import LeftBottom from "./left-bottom.vue";
import CenterMap from "./center-map-tj.vue";
import CenterBottom from "./center-bottom.vue";
import RightTop from "./right-top.vue";
import RightCenter from "./right-center.vue";
import RightBottom from "./right-bottom.vue";

import CenterBottomLeft from "./center-bottom-left.vue";
import CenterBottomRight from "./center-bottom-right.vue";

import ThreedModel from './ThreedModel.vue';
import ConfIssue from './conf-issue.vue';
import ItemWrapNoframe from '@/components/item-wrap/item-wrap-noframe.vue';

export default {
  components: {
    LeftTop,
    LeftCenter,
    LeftBottom,
    CenterMap,
    RightTop,
    RightCenter,
    RightBottom,
    CenterBottom,
    CenterBottomLeft,
    CenterBottomRight,
    ThreedModel,
    ConfIssue,
  },  
  data() {
    return {
      currentView: 'ThreedModel',
      // currentView: 'ConfIssue',
      titleMapping: {
        ThreedModel: '3d动画效果',
        ConfIssue: '下单配置'
      },
    };
  },
  filters: {
    numsFilter(msg) {
      return msg || 0;
    },
  },
  created() {
  },

  computed: {
    currentTitle() {
      return this.titleMapping[this.currentView] || '未知标题';
    }
  },
  mounted() {},
  methods: {
    changeView(view) {
      console.log('Changing view to:', view);
      this.currentView = view;
    }
  },
};
</script>
<style lang="scss" scoped>
// 内容
.contents {
  .content_left,
  .contetn_right {
    width: 540px;
    box-sizing: border-box;
    justify-content: space-between;
    height: 100%;
    // padding: 16px 0;
  }

  //左右两侧 三个块
  .content_lr-item {
    height: 332px;
    position: relative;
    z-index: 1000;
  }

  .content_center_top {
    width: 100%;
    height: 680px;
    z-index: 0;
  }

  // 中间下
  .content_center {
    display: flex;
    flex-direction: column; /* 将容器设置为垂直方向的Flex容器 */
    position: relative;
    width: 800px;
    left: 1px;
    height: 40%;
    box-sizing: border-box;

    .content_cb-item {
      // flex: 0 1 auto; /* 使这个元素占据上方，并自动调整其大小 */
      width: 100%;
      box-sizing: border-box;
      height: 665px;

      .home_page {
        position: absolute;
        top: 10%;
        left: 10%;
        transform: translate(-50%, -50%);
        width: 100px;
        height: 40px;
        line-height: 40px;
        text-align: center;
        border-radius: 4px;
        cursor: pointer;
        background-image: linear-gradient(to left top, rgb(18, 220, 247), rgb(57, 36, 135));
        font-family: 'Times New Roman', Times, serif;
        color: #2bd4f6;
        font-weight: bolder;
        font-size: larger;
        border-radius: 64px;
        z-index: 10;
      }
      .command_page {
        position: absolute;
        top: 10%;
        right: -4%;
        transform: translate(-50%, -50%);
        width: 100px;
        height: 40px;
        line-height: 40px;
        text-align: center;        
        // background-image: linear-gradient(to bottom, rgb(172, 225, 232), transparent);
        background-image: linear-gradient(to left top, rgb(18, 220, 247), rgb(57, 36, 135));
        border-radius: 4px;
        cursor: pointer;
        font-family:'Courier New', Courier, monospace;
        color: #2bd4f6;
        font-weight: bolder;
        font-size: larger;
        border-radius: 64px;
        z-index: 10;
      }
    }

    .content_center_bottom {
      display: flex; /* 创建一个水平方向的Flex容器用于下方区域 */
      flex: 1; /* 使这个容器占据剩余的空间 */
      width: 100%;
      box-sizing: border-box;   
    }

    .content_cbl-item {
      max-width: 50%;
      box-sizing: border-box;
      top: 20px;
    }
    
    .content_cbr-item {
      max-width: 50%;
      box-sizing: border-box;
      top: 20px;
    }
  }


  //左边 右边 结构一样
  .content_left,
  .contetn_right {
    display: flex;
    flex-direction: column;
    position: relative;
  }
}


@keyframes rotating {
    0% {
        -webkit-transform: rotate(0) scale(1);
        transform: rotate(0) scale(1);
    }
    50% {
        -webkit-transform: rotate(180deg) scale(1.1);
        transform: rotate(180deg) scale(1.1);
    }
    100% {
        -webkit-transform: rotate(360deg) scale(1);
        transform: rotate(360deg) scale(1);
    }
}
</style>
